/**
 * Created by lxy_920912 on 28/03/2017.
 */
var multiply = function(num1, num2) {
    var len1 = num1.length;
    var len2 = num2.length;
    var list = [];
    if(num1 == 0 || num2 == 0){
        return '0';
    }
    var len = 0;
    for(var i = 0;i < 222;i++){
        list[i] = 0;
    }
    for(var i = 0;i < len1;i++){
        var flag = 0;
        for(var j = 0;j < len2;j++){
            var result = parseInt(num1.charAt(len1-1-i))*parseInt(num2.charAt(len2-1-j));
            list[i+j] = list[i+j]+result+flag
            flag =Math.floor(list[i+j]/10);
            list[i+j] = list[i+j]%10;
        }
        if(flag != 0){
            list[i+j] = list[i+j]+flag;
            len = i+j+1;
        }else{
            len = i+j;
        }

    }
    var pro = list.slice(0,len).reverse().join('');
    console.log(pro);
    return pro;

};
multiply('888','999');